Repository navigation
feat(bridge): bridge, then buy from the token page - #126
Closed
Vasanthdev2004 wants to merge 2 commits into
Closed
Vasanthdev2004 wants to merge 2 commits into
Vasanthdev2004 wants to merge 2 commits into
Conversation
When a buyer is short of what a buy pays with, the trade panel shows a two-step card: bridge first, then buy. It reads the wallet's bridge assets on every other network and suggests the largest source worth moving that can pay its own gas. It opens the header bridge on that route (no amount). It then follows the transfer from this browser's ledger and reads the pay balance again as soon as the funds arrive. - lib/bridge/fund.ts: pay-asset mapping, holdings reader (each network read stands alone), source pick by USD value or same kind, two-hour follow window, step derivation - BridgeProvider: open on a route from inside the app, wake the one controller closed for background tracking, re-apply a repeated route, and drop a stale request once the /bridge page takes over - BridgeToBuy + Fund.module.css: Signal-plate card, never signs or sends - TradePanel: shortfall, balance refetch on arrival, card on the buy side - /ui-review-bridge fund scenes, unit and guard tests, docs
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Collaborator
Author
|
Closed in favour of #135, which holds the whole bridge update in one PR. The commits from this PR are in it unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 4 of the bridge update. Stacked on #125 (transfer history), and the base branch retargets as the lower PRs merge.
What it does
A buyer on a token page who is short of what the buy pays with now gets a two-step card in the trade panel: 1. bridge, 2. buy. These stay two separate wallet prompts. An atomic bridge-and-buy is out of scope because a Relay destination call runs from Relay's contract, not the buyer's wallet, so it needs its own reviewed design.
Changes
lib/bridge/fund.ts(new, pure)bridgeAssetForPay,readBridgeHoldingspickBridgeSource,formatFundAmountfollowedBridge,fundStepcomponents/bridge/BridgeToBuy.tsxandFund.module.css(new): the card, using the Signal-board plate, plusFundCardbuilt from plain props for the fixture.BridgeProvideruseOpenBridge()(link?)opens the bridge on a route.useWakeBridge()mounts the controller closed./bridgetakes over.BridgeDialog:linkCountmakes a repeated request for the same route apply again.TradePanel: computes the shortfall, addsrefetchPay, and renders the card on the buy side./ui-review-bridge: seven fund scenes. Tests:fund.test.ts(5) and a guard test inbridge-ui.test.ts. Docs: "Bridge, then buy" indocs/bridge.md.Verification
npm test: 1460 tests, 1384 pass, 48 skipped and 28 fail. The 28 failures are the same set as on main and are unrelated.tsc --noEmitis clean, and eslint on the changed files is clean./ui-review-bridgefund scenes look right on desktop and at 375px, in light and dark, with no overflow./bridgestill renders its panel and transfer board.